home *** CD-ROM | disk | FTP | other *** search
/ CD ROM Paradise Collection 4 / CD ROM Paradise Collection 4 1995 Nov.iso / misc / vpan100.zip / VPDEMO.CPP < prev    next >
C/C++ Source or Header  |  1995-01-12  |  18KB  |  680 lines

  1. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  2. //
  3. //            HERE IS DEMO PROGRAM
  4. //
  5. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  6. #include "vphead.h"    // must be included first
  7. #pragma hdrstop
  8.  
  9. #include "vpbase.h"
  10. #include "vpboard.h"
  11. #include "vpoutbox.h"
  12. #include "vpinbox.h"
  13. #include "vpindic.h"
  14. #include "vpgraph.h"
  15. #include "vpbutt.h"
  16.  
  17.  
  18. #define      BGIPATH    "..\\bgi"
  19. #define NPOINTS  100
  20. #define CNF_NAME    "vpdemo.cnf"
  21.  
  22.   int far EGAVGA_driver_far[1];
  23. //+++++++++++++++++++++++++++++++++++++++++
  24. //++++++   GLOBAL VARIABLES +++++++++++++++
  25. //+++++++++++++++++++++++++++++++++++++++++
  26.  
  27. float Temp=-77.02,Volt=1.64;
  28. float afsignal[ NPOINTS ];
  29.  
  30. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++
  31. //++++++     COLOR CONFUGURATION         +++++++++
  32. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++
  33.  
  34.  
  35. plaquecolors framecolconfig={
  36.              LIGHTGRAY,    // PlaqeColor
  37.              DARKGRAY,    // shadow
  38.              WHITE    // ltnd
  39.             };
  40.  
  41.  
  42. int dispcolconfig= GREEN;
  43.  
  44. const graphcolors OscColors={
  45.         BLUE,        //paper color
  46.         LIGHTGREEN,    //Ink color
  47.         LIGHTBLUE,    //Grid2Col
  48.         RED,        //titlecolor
  49.         BLACK,        //texcolor
  50.         YELLOW        //divvalcolor
  51.         };
  52.  
  53. //+++++++++++++++ END OF COLOR CONFIGURATION +++++++++++++++++
  54. //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  55.  
  56. //++++++++++++++++ REFERENCES TO OBJECTS ++++++++++++++++
  57.  
  58. Graph<double,double> *grOsc,*grFourierLOG, *grPickup;
  59. Graph<float,float>   *grFourierBar;
  60.  
  61. butsystem *pbsMain;
  62. Indicator<float>  *indVolt,*indTemp;
  63. _Indicator *Clock,*indInfo;
  64. Outbox *obxHelp;
  65. Board *brdEnter;
  66. indbutton *pib1,*pib2,*pib3;
  67. indbutton *pi_b1,*pi_b2,*pi_b3;
  68. LED *ledind;
  69.  
  70. //++++++++++++++++++++ FUNCTIONS +++++++++++++++++++++++++++
  71. float ph;
  72. double far signal(double x)
  73. {
  74.  float xa,y;
  75.  xa=fabs(x);
  76.  if(xa<=.5) y=1.-6*xa*xa*(1-xa);
  77.      else if (xa>=.5 && xa<=1.) y=2*pow(1-xa,3);
  78.       else y=0.;
  79.  y*=sin(M_PI*x)/(M_PI*x);
  80.  return y;
  81.  }
  82. double far fsignal(double x)
  83. {
  84.  return .75*pow(sin(M_PI*x/2)/(M_PI*x/2),2);
  85.  }
  86.  
  87. double far sinsignal(double x)
  88. { return sin(5*x+ph);        //sin(200*(x+ph))*sin(20*(x+ph));
  89.  }
  90.  
  91. //+++++++++++++++++++++++++++++++++++++++++++++++++++++
  92. //+++++++++ PROCEDURES ATTACHED TO BUTTONS ++++++++++++
  93. //+++++++++     AND PAINT PROCEDURES       ++++++++++++
  94. //+++++++++++++++++++++++++++++++++++++++++++++++++++++
  95. int r=0,g=0,b=0;
  96. EGA_COLORS  colPal=EGA_LIGHTGRAY;
  97.  
  98. void far BackgrProc(void)    // user defined background routine
  99. { }
  100. //-------------------------*
  101. // Buttons with indicators |
  102. //-------------------------*
  103. void far bpib1(void) {pib1->Invert();}
  104. void far bpib2(void) {pib2->Invert();}
  105. void far bpib3(void) {pib3->Invert();}
  106.  
  107. void far bpi_b1(void) {pi_b1->Invert();}
  108. void far bpi_b2(void) {pi_b2->Invert();}
  109. void far bpi_b3(void) {pi_b3->Invert();}
  110.  
  111. //-----------------------------------
  112. //---------- Palette choosing procs
  113. //-----------------------------------
  114.  
  115. Indicator<int> *indRed, *indGreen, *indBlue;
  116.  
  117. void far bpRedInc()
  118. { r=(++r) & 0x3f; setrgbpalette(colPal,r,g,b); indRed->Put(r);}
  119.  
  120. void far bpRedDec()
  121. { r=(--r) & 0x3f; setrgbpalette(colPal,r,g,b); indRed->Put(r);}
  122.  
  123. void far bpGrnInc()
  124. { g=(++g) & 0x3f; setrgbpalette(colPal,r,g,b); indGreen->Put(g);}
  125.  
  126. void far bpGrnDec()
  127. { g=(--g) & 0x3f; setrgbpalette(colPal,r,g,b); indGreen->Put(g);}
  128.  
  129. void far bpBlueInc()
  130. { b=(++b) & 0x3f; setrgbpalette(colPal,r,g,b); indBlue->Put(b);}
  131.  
  132. void far bpBlueDec()
  133. { b=(--b) & 0x3f; setrgbpalette(colPal,r,g,b); indBlue->Put(b);}
  134.  
  135. void far bpPalNextCol()
  136. { switch (colPal)
  137.   { case EGA_LIGHTGRAY: {colPal=EGA_WHITE;break;}
  138.     case EGA_WHITE    : {colPal=EGA_DARKGRAY;break;}
  139.     case EGA_DARKGRAY : {colPal=EGA_LIGHTGRAY;break;}
  140.   }
  141. }
  142.  
  143. void far bpPalPrevCol()
  144. { switch (colPal)
  145.   { case EGA_LIGHTGRAY: {colPal=EGA_DARKGRAY;break;}
  146.     case EGA_WHITE    : {colPal=EGA_LIGHTGRAY;break;}
  147.     case EGA_DARKGRAY : {colPal=EGA_WHITE;break;}
  148.   }
  149. }
  150. //----------------------------
  151.  
  152. void far bpPalette()
  153. {
  154. #define BLXPal 82
  155. #define BLYPal 22
  156.  
  157.     //-------------------- COLOR setting for indicators
  158. const indicatorcolors LCDred={
  159.                RED,    // color of title
  160.                DARKGRAY,// foreground color
  161.                YELLOW    // background color
  162.                };
  163. const indicatorcolors LCDgreen={
  164.                GREEN,    // color of title
  165.                DARKGRAY,// foreground color
  166.                YELLOW    // background color
  167.                };
  168.  
  169. int ax0=maxxx>>2,ay0=maxyy>>2;
  170. int ax0t=ax0+20,ay0t=ay0+50;    // temporary storage
  171.  
  172. butsystem  bsPalette;    // NEW BUTTON SYSTEM
  173.  
  174. indRed = new Indicator<int> (
  175.         ax0t,ay0t,
  176.         FIXED,
  177.         "Red",        // title
  178.         8, &r,"%5u",    // width of disp in chars,format
  179.         UNFRAMED,
  180.         procNULL,
  181.         0,1,        //font and size of number
  182.         0,1,        //font and size of title
  183.         framecolconfig,LCDred);
  184.  
  185. int ix0,iy0,ixmax,iymax;    // size of indicator
  186.  indRed->GetXY(&ix0,&iy0,&ixmax,&iymax);
  187.  
  188. indGreen = new Indicator<int>(
  189.         ixmax+20,ay0t,
  190.         FIXED,
  191.         "Green",    // title
  192.         8, &g,"%5u",    // width of disp in chars,format
  193.         UNFRAMED,
  194.         procNULL,
  195.         0,1,        //font and size of number
  196.         0,1,        //font and size of title
  197.         framecolconfig,LCDgreen);
  198.  
  199. indBlue = new Indicator<int>(
  200.         indGreen->xmax+20,ay0t,
  201.         FIXED,
  202.         "Blue",        // title
  203.         8, &b,"%5u",    // width of disp in chars,format
  204.         UNFRAMED,
  205.         procNULL,
  206.         0,1,        //font and size of number
  207.         0,1,        //font and size of title
  208.         framecolconfig,LCDbright);
  209.  
  210.     //---------------- Buttons ------
  211. int  bxsz=ixmax-ix0-4>>1;
  212. butgrp gr1(ix0,iymax+2,bxsz,20);
  213.   button butRedInc("R=+",'r','R',bpRedInc);
  214.   button butRedDec("T=-",'t','T',bpRedDec);
  215.  gr1.ShiftToX(ixmax+20);
  216.   button butGrnInc("G=+",'g','G',bpGrnInc);
  217.   button butGrnDec("H=-",'h','H',bpGrnDec);
  218.  gr1.ShiftToX(indBlue->x0);
  219.   button butBlueInc("B=+",'b','B',bpBlueInc);
  220.   button butBlueDec("N=-",'n','N',bpBlueDec);
  221.  
  222.  bxsz=3*bxsz+20;
  223. int  brdszx=x__xx(indBlue->xxmax-ax0)+20;
  224. butgrp gr2(ix0,butRedInc.ymax+4,bxsz,25,HORIZ,brdszx-2*(ix0-ax0+bxsz));
  225.  button butPalNextCol("Z=Next Color",'z','Z',bpPalNextCol);
  226.  button butPalPrevCol("X=Previous Color",'x','X',bpPalPrevCol);
  227.  
  228. Board brdPalette(
  229.          x__xx(ax0),y__yy(ay0),    // left top coord
  230.          POPUP,            // may be FIXED,PERM,POPUP
  231.          "Choose Palette for VGA",     // title
  232.          brdszx,// size of board
  233.          y__yy(butPalPrevCol.yymax-ay0+20),
  234.          procNULL,
  235.          TRIPLEX_FONT,3);    // title FONT
  236.  
  237.     //---------------- Paint whole board
  238.  brdPalette.Paint();
  239.  
  240.  indRed->Paint();
  241.  indGreen->Paint();
  242.  indBlue->Paint();
  243.  
  244.  indRed->Put(r);
  245.  indGreen->Put(g);
  246.  indBlue->Put(b);
  247.  
  248.  gr1.Paint();
  249.  gr2.Paint();
  250.  
  251.  bsPalette.NextTabStop();
  252.  bsPalette.Loop(BackgrProc);
  253.  
  254.  delete indRed;
  255.  delete indGreen;
  256.  delete indBlue;
  257.  
  258.  brdPalette.Remove();
  259. }
  260. //-----------------------------------
  261. void far ppPickup(void)
  262. {
  263.  grPickup->Paint();
  264.  grPickup->ShowCurve(NPOINTS,signal);
  265. }
  266.  
  267. void far bpPickup(void)
  268. {
  269.  ppPickup();
  270.  grPickup->MkActive();
  271. }
  272. //-------------------------------
  273.  
  274. void far ppFourierLOG(void)
  275. {
  276. grFourierLOG->Paint();
  277. grFourierLOG->ShowCurve(NPOINTS,fsignal);
  278. }
  279.  
  280. void far bpFourierLOG(void)
  281. {
  282.  ppFourierLOG();
  283.  grFourierLOG->MkActive();
  284. }
  285. //-------------------------------
  286.  
  287. void far ppFourierBar(void)
  288. {
  289. grFourierBar->Paint();
  290. grFourierBar->ShowHistogram( NPOINTS, -8., 16./(NPOINTS-1), afsignal, LIGHTGREEN);
  291. }
  292.  
  293. void far bpFourierBar(void)
  294. {
  295.  ppFourierBar();
  296.  grFourierBar->MkActive();
  297. }
  298. //-------------------------------
  299.  
  300. void far bpQuit(void)
  301. {
  302.  object::SaveCnfg(CNF_NAME);
  303.  QuitVirtualPanels();
  304.  exit(0);
  305. }
  306. //--------------------------------
  307.  
  308. int sx=0;
  309. void far bpOsc(void)    // popup graph
  310. {
  311.  grOsc->Paint();
  312.  grOsc->MkActive();
  313.  ph=0.;
  314.  do{
  315.    ph-=.5;
  316.    grOsc->ShowCurve(NPOINTS,sinsignal);
  317.    grOsc->HideCurve(NPOINTS,sinsignal);
  318.    }while(!kbhit());
  319.  grOsc->Remove();
  320. }
  321. //---------------------------
  322. void far ppTemp()
  323. {                            // perm ind
  324.  indTemp->Paint();
  325.  indTemp->Put(Temp);
  326. }
  327.  
  328. void far bpTemp()
  329. {
  330.  ppTemp();
  331.  indTemp->MkActive();
  332. }
  333. //---------------------------
  334. void far bpVolt()
  335. {                            // popup indicator
  336.  indVolt->Paint();
  337.  indVolt->Put(Volt);
  338.  indVolt->MkActive();
  339.  while(!kbhit());
  340.  indVolt->Remove();
  341.  }
  342. //-----------------------------
  343.  
  344. void far bpEnter()
  345. {                            // popup
  346. butsystem bsEnter;
  347.  
  348. TSInbox<float>                  // size of box
  349.  tibTemp( brdEnter->x0, brdEnter->y0p,"Temperature:", 12, &Temp, "%f", "%.2f");
  350.  
  351. TSInbox<float>
  352.   tibVolt( brdEnter->x0, tibTemp.ymax, "Voltage:", 12, &Volt,"%f","%.2f");
  353.  
  354. butgrp grpv(tibVolt.xmax+26, brdEnter->y0p+10, 100, 16, VERT, 2);
  355.  indbutton i_b1("Heater",'\x0','\x0',bpi_b1);
  356.  indbutton i_b2("Ventilation",'\x0','\x0',bpi_b2);
  357.  indbutton i_b3("SaveOnExit",'\x0','\x0',bpi_b3);
  358.  
  359.  i_b2.Disable();
  360. pi_b1=&i_b1;pi_b2=&i_b2;pi_b3=&i_b3;
  361.  
  362.  brdEnter->ChangeSize( i_b1.xmax - tibVolt.x0 +10,
  363.               tibVolt.ymax - brdEnter->y0);
  364.  
  365.  brdEnter->Paint();
  366.  tibTemp.Paint();
  367.  tibVolt.Paint();
  368.  tibTemp.Refresh();
  369.  tibVolt.Refresh();
  370.  grpv.Paint();
  371.  
  372.  bsEnter.NextButton();
  373.  bsEnter.Loop( procDummy);
  374.  
  375.  brdEnter->MkActive();
  376.  brdEnter->Remove();
  377.  if( indTemp->OnScreen )
  378.     indTemp->Put(Temp);    // refresh
  379. }
  380.  
  381. //---------------------------- BP HELP -----
  382. void far bpHelp()
  383. {                            // popup output box
  384. #define    hN  8    // number of rows of help text
  385. int i;
  386.   //------------------- HELP text
  387. char *txt[2][hN]=
  388.  {
  389.   {"Alt-F3","Ctrl-F5","F6","Left,Right,Up,Down","Ctrl-Left,Right,Up,Down",
  390.     "Tab","Shift-Tab","Esc"},
  391.   {"close window", "start dragging object", "switch between objects",
  392.    "quick drag", "slow drag",
  393.    "go to next button group", "go to prev. button group",
  394.    "quit"}
  395.   };
  396.  
  397.  obxHelp->Paint();
  398.  obxHelp->MkActive();
  399.         // hilight text output
  400.  for (i=0;i<hN;i++) obxHelp->Printfn(1,txt[0][i]);
  401.  
  402.  obxHelp->GotoXY(0,0);
  403.  obxHelp->SetTextJustify(RIGHT_TEXT);    // normal text output
  404.  for (i=0;i<hN;i++) obxHelp->Putn(txt[1][i]);
  405.  
  406.  obxHelp->GotoXY(0,-1);     // put cursor at bottom of box
  407.  obxHelp->SetTextJustify(CENTER_TEXT);
  408.  obxHelp->SetTextColor(LIGHTGREEN);
  409.  obxHelp->Put("Press any key...");
  410.  obxHelp->SetTextColor(WHITE);
  411.  getch();
  412.  
  413.  obxHelp->cls();
  414. int x,y; obxHelp->GetXY(&x,&y);
  415.  obxHelp->Printfn(0,"x=%d",x);
  416.  obxHelp->Printf(0,"y=%d",y);
  417.  
  418.  getch();
  419.  obxHelp->Remove();
  420.  }
  421.  
  422. //++++++++++++++++++ PRINT ABOUT ++++++++++++++++++++
  423.  
  424. #define LF_CR   gprintf_n(&xloc,&yloc,"")
  425.  
  426. void prnextr(int *xloc,int *yloc,char *text)
  427. {
  428.  setcolor(WHITE);
  429.  gprintf(*xloc-1,*yloc-1,text);
  430.  setcolor(DARKGRAY);
  431.   gprintf(*xloc+1,*yloc+1,text);
  432.  setcolor(LIGHTGRAY);
  433.   gprintf_n(xloc,yloc,text);
  434. }
  435.  
  436.  
  437. void PrintAbout(int tfont)
  438. {
  439. int axl=maxxx>>1,ayl=maxyy>>1;
  440. int ax0=axl>>1,ay0=ayl>>1;
  441. int xloc=ax0,yloc=0;
  442. Board about(
  443.     x__xx(ax0),y__yy(ay0),    // left top coord where to paint the board
  444.     POPUP,            // may be FIXED,PERM,POPUP
  445.     "",                  // title
  446.     x__xx(axl),y__yy(ayl),        // size of board
  447.     procNULL,tfont,4);    // set font for first row
  448.  
  449.  about.Paint(); // is put here to release far heap before font
  450.  
  451.  setviewport(ax0,ay0,3*ax0,3*ay0,CLIP_OFF);
  452.  settextjustify(CENTER_TEXT,TOP_TEXT);
  453.  LF_CR;
  454.   prnextr(&xloc,&yloc,"Virtual Panels");
  455.  settextstyle(tfont,HORIZ_DIR,3);
  456.   prnextr(&xloc,&yloc,"for lab works");
  457.  settextstyle(tfont,HORIZ_DIR,2);
  458.   prnextr(&xloc,&yloc,"version 1.0");
  459.  settextstyle(0,HORIZ_DIR,1);
  460.  yloc+=10*yyspacing;
  461.  setcolor(LIGHTGREEN);
  462.   gprintf_n(&xloc,&yloc,"by O.Rasizade");
  463.   gprintf_n(&xloc,&yloc,"");
  464.   gprintf_n(&xloc,&yloc,"written  1993");
  465.  
  466.  getch();
  467.  about.Remove();
  468. }
  469. //++++++++++++++++++++++ BACKGROUND PROCEDURE +++++++++++++++++++
  470. void far procClock(void)
  471. {
  472. struct  time t;
  473. static int sec;
  474.  
  475.  if ( (pbsMain->ConStatus & KBD_HIT) == 1)
  476.    goto info;
  477.  gettime(&t);
  478.  if (sec!=t.ti_sec)
  479.   { Clock->Put(t.ti_hour, t.ti_min, t.ti_sec);
  480.     sec=t.ti_sec;
  481.     ledind->Invert();
  482.  
  483. info:
  484.  indInfo->Paint();
  485.  indInfo->Put(pbsMain->key0,pbsMain->key1,pbsMain->ConStatus);
  486.  
  487.   }
  488. }
  489. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  490. //++++++++++++++++++++++++ MAIN+++++++++++++++++++++++++++++++++
  491. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  492.  
  493.  
  494. main()
  495. {
  496. InitAndCopyright("* VirtualPanels Demo * by O.Rasizade, 1993, JINR, Dubna *", MAGENTA, CLOSE_DOT_FILL);
  497. PrintAbout(TRIPLEX_FONT);
  498.  
  499. butsystem bsMain( MASTER );
  500.  
  501. pbsMain = &bsMain;
  502.  
  503. float dx = 16./ (NPOINTS-1) ;
  504.  
  505. for ( int i=0; i < NPOINTS; i++)
  506.     afsignal[i] = fsignal( -8.+ i*dx );
  507.  
  508. Graph<double,double>  _grPickup( x0s,y0s, PERM, "Pickup coil voltage",
  509.                 8,4,    /* number of x & y div.            */
  510.                 35,35,    /* number of pixels at every div.    */
  511.                 -.8,0.,    /* values of x,y at origin    */
  512.                 .8,1.,    /* max values of x,y        */
  513.                 ppPickup,
  514.                 "Time (ms)","Signal (mV)",    /* text on the axises        */
  515.                 "%.1f","%.1f",             /* format of values on divisions*/
  516.                 LIN, LIN, FRAMED,
  517.                 TRIPLEX_FONT,2,    //title font and fontsize
  518.                 TRIPLEX_FONT,2);    //text font and fontsize
  519.  
  520. Graph<double,double>    _grOsc( x0s, y0s, POPUP, "Osciloscope",
  521.                 5,4,    /* number of x & y div.            */
  522.                 30,30,    /* number of pixels between tics*/
  523.                 -1.,-1.,    /* values of x,y at origin    */
  524.                 1.5,1.,    /* max values of x,y         */
  525.                 bpOsc,
  526.                 "","","","", LIN, LIN, UNFRAMED,
  527.                 0,1, 0,1, 0,1,
  528.                 OscColors,framecolconfig);
  529.  
  530.  
  531. Graph<double,double>  _grFourierLOG( x0s,y0s,PERM, "Fourier transform",
  532.             3, 4,    // number of x & y div.
  533.             90, 60,    /* number of pixels     */
  534.             -1, -4,    /* values of x,y at origin    */
  535.             0.,0.,    /* max values of x,y    */
  536.             ppFourierLOG,
  537.             "Frequency (hz)","Amplitude",    /* text on the axises        */
  538.             "%.1f","%.1f",            /* format of values on divisions*/
  539.             LOG, LOG );
  540.  
  541. Graph<float,float>   _grFourierBar( x0s,y0s, PERM, "Fourier transform",
  542.                 16, 5,    /* number of x & y div.            */
  543.                 20, 30,    /* number of pixels in every div.    */
  544.                 -8., 0.,/* values of x,y at origin    */
  545.                 8.,1.,    /* max values of x,y         */
  546.                 ppFourierBar,
  547.                 "Frequency (hz)","Amplitude",    /* text on the axises        */
  548.                 "%.1f","%.1f" );/* format of values on divisions*/
  549.  
  550. grOsc=&_grOsc;
  551. grFourierLOG=&_grFourierLOG;
  552. grFourierBar=&_grFourierBar;
  553. grPickup=&_grPickup;
  554.  
  555.  
  556. Indicator<float>
  557.      _indTemp(
  558.         x0s,y0s,
  559.         PERM,           // type
  560.         "Temperature",    // title
  561.         12, &Temp,"%8.2f\370C",// width of disp in chars,format
  562.         FRAMED,
  563.         ppTemp,
  564.         SANS_SERIF_FONT,4,    //font and size of number
  565.         1,4,            //font and size of title
  566.         framecolconfig,LEDind),
  567.  
  568.       _indVolt(
  569.         x0s,y0s,
  570.         POPUP,
  571.         "Voltage" ,        // title
  572.         9, &Volt,"%2.3fmV",     // width of disp in chars,format
  573.         FRAMED,
  574.         bpVolt,
  575.         SANS_SERIF_FONT,4,//font and size of number
  576.         1,4            //font and size of title
  577.         );
  578.  
  579. indVolt=&_indVolt;
  580. indTemp=&_indTemp;
  581.  
  582. obxHelp = new Outbox (
  583.          maxx>>2,maxy>>2,// left top coord
  584.          POPUP,            // may be FIXED,PERM,POPUP
  585.          "Help",             // title
  586.          35,10,    // size of board
  587.          FRAMED,
  588.          bpHelp,3,4    // title font
  589.          );
  590.  
  591. butgrp grp1(3,maxy-26,70,20,HORIZ,2);
  592.  button butQuit("Quit",'Q','q',bpQuit,0,1,quittexcol,quitbutcol);
  593.  button butFourierLOG("fourLOG",'L','l',bpFourierLOG);
  594.  button butFourierBar("fourBar",'B','b',bpFourierBar);
  595.  button butPickup("pickUp",'U','u',bpPickup);
  596.  button butTemp("T \370C",'t','T',bpTemp);
  597.  button butPalette("Palette",'P','p',bpPalette);
  598.  button butHelp("Help",'h','H',bpHelp);
  599.  
  600.  
  601. //-------------- Enter Board------------
  602. Board _brdEnter(
  603.      x0s,y0s,//maxx>>2,maxy>>2,
  604.      POPUP,        // may be FIXED,PERM,POPUP
  605.      "Dialog Box",    // title
  606.      0,0,        // size of board
  607.      bpEnter );
  608. brdEnter = &_brdEnter;
  609. //------------------------------ Clock ------------
  610. _Indicator _Clock(
  611.         0,0,
  612.         FIXED,           // type
  613.         "Time",    // title
  614.         8,"%2d:%02d:%02d",// width of disp in chars,format
  615.         UNFRAMED,
  616.         procNULL,
  617.         SANS_SERIF_FONT,1);    //font and size of number
  618.  Clock=&_Clock;
  619.  
  620. int cxlen2=_Clock.xmax-_Clock.x0+4;
  621.  xxmaxs=maxxx-cxlen2;
  622.  yymaxs=maxyy-30; ymaxs=y__yy(yymaxs);
  623.  _Clock.MovetoXY(2+(xmaxs=x__xx(xxmaxs)),y0s+10);
  624.  
  625. //------------------------------- Draw control panel with clock
  626.  
  627. plaque plqControl1(maxx-cxlen2-1,y__yy(29));
  628. plaque plqControl2(cxlen2-1,maxy-y0s);
  629.  plqControl1.PaintAt(0,ymaxs+1);
  630.  plqControl2.PaintAt(xmaxs+1,y0s);
  631.  _Clock.Paint();
  632.  
  633. butgrp grp2(xmaxs+6,maxy-140,80,40,VERT);
  634.  button butEnter("Enter",'e','E',bpEnter,TRIPLEX_FONT,1);
  635.  button butVolt("mV",'t','T',bpVolt,TRIPLEX_FONT,1);
  636.  button butOsc("Signal",'s','S',bpOsc,TRIPLEX_FONT,1);
  637.  
  638. //------ BUTTONS with INDICATORS ----
  639.  
  640. butgrp grph(xmaxs+8,_Clock.ymax+30,(cxlen2>>2),16,HORIZ,0);
  641.  indbutton ib1("ib1",'\x0','\x0',bpib1,5,0,1,greenLED);
  642.  indbutton ib2("ib2",'\x0','\x0',bpib2);
  643.  indbutton ib3("ib3",'\x0','\x0',bpib3,3,0,1,yellowLED);
  644.  
  645. pib1=&ib1;pib2=&ib2;pib3=&ib3;
  646.  
  647.  grp1.Paint();
  648.  grp2.Paint();
  649.  grph.Paint();
  650.     //----------- INFO INDICATOR ----------
  651. _Indicator _indInfo(
  652.         maxx>>2,maxy>>2,PERM,"Info",
  653.         25,"key0=%X key1=%X STATUS=%X",
  654.         FRAMED,
  655.         procDummy,
  656.         SMALL_FONT,4,    //font and size of number
  657.         3,3,            //font and size of title
  658.         framecolconfig,LUMind);
  659. indInfo = &_indInfo;
  660.  
  661.     //--------- LED INDICATOR ------
  662. LED _ledind(xmaxs+30,_Clock.ymax+5, "Ticks",    // Hereafter are defaults
  663.        4,            // radius of indicator
  664.        SMALL_FONT, 4 );           // font style and size of title
  665. ledind=&_ledind;
  666.  _ledind.Paint();
  667.  
  668.  bsMain.NextTabStop();
  669.  
  670.  object::LoadCnfg(CNF_NAME);
  671.  object::RepaintScr();
  672.  
  673.  bsMain.Loop(procClock);
  674.  
  675.  object::SaveCnfg(CNF_NAME);
  676.  delete obxHelp;
  677.  QuitVirtualPanels();
  678. }
  679. //++++++++++++++++++++++++ END OF MAIN ++++++++++++++++++++++++
  680.